import axios from 'axios'

axios.defaults.baseURL = 'http://localhost:8888/api'

export const getNewsList = () => axios.get('/getnewslist').then(res => res.data)

// 获取某新闻的评论
export const getComment = (id, pageindex) => axios.get(`/getcomments/${id}`, { params: { pageindex } }).then(res => res.data)

// 发表评论
export const postComment = (id, content) => axios.post(`/postcomment/${id}`, content).then(res => res.data)

// 获取新闻详情
export const getNewsDetail = id => axios.get(`/getnew/${id}`).then(res => res.data)
